<template>
  <div class="yuan">
    <div id="main"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";

export default {
  mounted() {
    var chartDom = document.getElementById("main");
    var myChart = echarts.init(chartDom);
    var option;
    option = {
      xAxis: {
        type: "category",
        data: ["未知", "17岁及以下", "18-24岁", "25-29岁", "30-39岁", "40-49岁", "50岁以上"],
      },
      yAxis: {
        type: "value",
      },
      series: [
        {
          data: [521, 200, 150, 80, 60, 110, 130],
          type: "bar",
        },
      ],
    };

    option && myChart.setOption(option);
  },
};
</script>

<style>
.yuan {
  width: 100%;
  height: 100%;
}
#main {
  width: 1000px;
  height: 600px;
}
</style>